$(document).ready(function(){
    var clickSum = 1;
    $(".loginMenu").click(function(){
        if(clickSum){
            $(".dropdown-toggle .glyphicon-menu-down").css({
                transition: 'transform 0.2s',
                transform: 'rotate(180deg)'
            });
            $(".dropdown-menu").slideDown("fast");
            clickSum--;
        }else{
            $(".dropdown-toggle .glyphicon-menu-down").css({
                transition: 'transform 0.2s',
                transform: 'rotate(0deg)'
            });
            $(".dropdown-menu").slideUp("fast");
            clickSum++;
        }
    });


    $(document).click(function(){
        if(!clickSum){
            $(".dropdown-toggle .glyphicon-menu-down").css({
                transition: 'transform 0.2s',
                transform: 'rotate(0deg)'
            });
            $(".dropdown-menu").slideUp("fast");
            clickSum++;
        }
    });


    $(".head").mouseover(function () {
        $(".st-container > input,.st-container > label").slideDown("fast");
    });

    $(".head"&&".st-container > label").mouseleave(function () {
        $(".st-container > input,.st-container > label").slideUp("fast");
    });

    var scroll = document.getElementsByClassName("st-scroll")[0];
    var panel = document.getElementsByClassName("st-panel");

    var clientH = window.innerHeight;
    scroll.style.height = clientH + "px";
    for (var i = 0; i < panel.length; i++) {
        panel[i].style.height = clientH + "px";
    }
    /*鼠标滚动*/
    var inputC = document.getElementsByTagName("input");
    var wheel = function (event) {
        var delta = 0;
        if (!event)//for ie
            event = window.event;
        if (event.wheelDelta) {//ie,opera
            delta = event.wheelDelta / 120;
        } else if (event.detail) {
            delta = -event.detail / 3;
        }
        if (delta) {
            handle(delta, inputC);
        }
        if (event.preventDefault)
            event.preventDefault();
        event.returnValue = false;
    };
    if (window.addEventListener) {
        window.addEventListener('DOMMouseScroll', wheel, false);
    }
    window.onmousewheel = wheel;

});

function handle(delta,arr) {
    var num;
    for(var i=0;i<arr.length;i++){
        if(arr[i].checked){
            num=i;
        }
    }
    if(delta>0 && num>0){
        num--;
        arr[num].checked=true;
    }else if(delta<0 && num<4){
        num++;
        arr[num].checked=true;
    }
}